<?php

namespace App\Admin\Views\SwtMachine;

use App\Admin\Logic\Dhe\DheMachineLogic;
use App\Models\SwtDheMachine;
use Dcat\Admin\Support\LazyRenderable;
use Throwable;

class DheMachineGoodsView extends LazyRenderable
{

    /**
     * Get the evaluated contents of the object.
     *
     * @return array|string
     * @throws Throwable
     */
    public function render()
    {
        $machine_info = SwtDheMachine::where('machine_id', $this->payload['id']) -> first();

        $goods_info = DheMachineLogic::getDHEMachineGoods($machine_info -> machine_code);

        return admin_view('admin.machine.goods', ['machine_info' => $machine_info, 'goods_info' => $goods_info]);
    }

}

